function userLogin(){
	var form=document.getElementById("Login-Info");
	var data=new FormData(form);
	var name=data.get("name");
	var psw=data.get("psw");
	if(name=='' || psw==''){
		alert("请填写完整");
	}else{
		//ajax提交用户名和密码
		$.ajax({
			type: 'post',
			url: '/login',
			data: new FormData(form),
			processData: false,
			contentType: false,
			success: function(arg){
				if(arg=='fail'){
					alert("登录失败，可能是密码错误或者用户不存在");
					return;
				}
				info=arg.substring(0,7);
				uid=arg.substring(7);
				if(info=='success'){
					document.cookie="username="+name;
					document.cookie="userid="+uid;
					window.location="/";
					return;
				}
			},
			fail: function(){
				alert("登录失败，请稍后再试");
			},
			error: function(){
				alert("服务器内部错误");
			}
		});
	}
}

function userRegister(){
	window.location="/register";
}